<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>成功页面</title>

    <!--导入vue和axios文件-->
    <script src="./plugins/vue/dist/vue.js"></script>
    <script src="./plugins/axios/dist/axios.js"></script>
    <script src="./js/common.js"></script>
</head>
<body>
<div id="app">
    <h1>
        小样儿，这你都进来了~~~
    </h1>
</div>

<script type="text/javascript">

    new Vue({
        el:'#app',
        data:{
            type:'wechat'
        },
        methods:{


        },
        mounted(){
            let code = getParameter("code")
            this.$http.get("/lr/wechatLogin/"+code).then(res=>{
                let {success,message,data} = res.data;
                if(success){
                    localStorage.setItem("userToken",data.userToken);
                    localStorage.setItem("userJsonStr",data.userJsonStr);
                    location.href = '/index.html'
                }else if(message == 'unbind'){
                    //未绑定，就跳转到绑定页面 传递access_token和openid两个参数
                    location.href = '/wechatUserBind.html?access_token=' + data.access_token + "&openid=" + data.openid;
                }else{
                    alert(message)
                }
            })
        }
    })

</script>
</body>
</html>